Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[workspace] Remove drake_vendor prefix from our include paths #19936

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented Aug 4, 2023

The purpose of the non-traditional include path within Drake (e.g., including <drake_vendor/tinyxml2.h> instead of just <tinyxml2.h>) was to avoid the hazard of accidentally picking up the OS copy of the header (e.g., /usr/include/tinyxml2.h).

When all of the BUILD files are correct, there is no hazard -- Bazel will always place the Drake-internal copy earlier on include path and that will always win out over the OS copy. Instead, the hazard happens during local development, while build system maintainers are iterating adding or updating externals. This had some moderate benefit as we've been iterating to build more and more externals from source. The ongoing benefit is more limited.

It also has some drawbacks. Downstream users of Drake who use our build system without modifications are fine, but more advanced users who want to substitute these dependencies with their own builds of the libraries suffer: they either need to provide their copy of the library with a weird drake_vendor include path, or patch Drake to switch the #include statements in the source code back to normal. There is an ongoing cost here for them, to keep up-to-date with regular updates and Drake churns.

On balance, the path switcheroo does not seem worth it anymore. Here, we undo all of the drake_vendor additions to the include paths. The ODR-safe addition of namespace drake_vendor { ... } in our own source builds of externals remains unchanged. The users users with their own builds can keep that intact or skip it, at their discretion.

Related to #17231.


This change is Reviewable

@jwnimmer-tri jwnimmer-tri marked this pull request as ready for review August 4, 2023 16:10
@jwnimmer-tri jwnimmer-tri added priority: low release notes: fix This pull request contains fixes (no new features) labels Aug 4, 2023
@jwnimmer-tri
Copy link
Collaborator Author

@drake-jenkins-bot linux-focal-unprovisioned-gcc-wheel-experimental-release please

@jwnimmer-tri
Copy link
Collaborator Author

+@rpoyner-tri for feature review, please.

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 57 of 57 files at r1, all commit messages.
Reviewable status: 1 unresolved discussion, needs at least two assigned reviewers


-- commits line 29 at r1:
typo

Suggestion:

users

The purpose of the non-traditional include path within Drake (e.g.,
including <drake_vendor/tinyxml2.h> instead of just <tinyxml2.h>)
was to avoid the hazard of accidentally picking up the OS copy of
the header (e.g., `/usr/include/tinyxml2.h`).

When all of the BUILD files are correct, there is no hazard -- Bazel
will always place the Drake-internal copy earlier on include path and
that will always win out over the OS copy. Instead, the hazard happens
during local development, while build system maintainers are iterating
adding or updating externals. This had some moderate benefit as we've
been iterating to build more and more externals from source. The
ongoing benefit is more limited.

It also has some drawbacks. Downstream users of Drake who use our
build system without modifications are fine, but more advanced users
who want to substitute these dependencies with their own builds of the
libraries suffer: they either need to provide their copy of the
library with a weird `drake_vendor` include path, or patch Drake to
switch the `#include` statements in the source code back to normal.
There is an ongoing cost here for them, to keep up-to-date with
regular updates and Drake churns.

On balance, the path switcheroo does not seem worth it anymore. Here,
we undo all of the `drake_vendor` additions to the include paths. The
ODR-safe addition of `namespace drake_vendor { ... }` in our own
source builds of externals remains unchanged. The users with their own
builds can keep that intact or skip it, at their discretion.
@jwnimmer-tri jwnimmer-tri force-pushed the rm-drake_vendor-include-path branch from afcb0a1 to 7504f72 Compare August 4, 2023 21:13
@jwnimmer-tri
Copy link
Collaborator Author

Hmm, are you OK with "single reviewer" here @rpoyner-tri? As it happens, this will be on the critical path for the VTK upgrade.

@rpoyner-tri rpoyner-tri added the status: single reviewer ok https://drake.mit.edu/reviewable.html label Aug 6, 2023
Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: +(status: single reviewer ok)

Reviewed all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignee rpoyner-tri(platform)

@rpoyner-tri rpoyner-tri merged commit c949c6d into RobotLocomotion:master Aug 6, 2023
@jwnimmer-tri jwnimmer-tri deleted the rm-drake_vendor-include-path branch August 6, 2023 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high release notes: fix This pull request contains fixes (no new features) status: single reviewer ok https://drake.mit.edu/reviewable.html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants